package com.wcll.www;
import java.util.*;
import java.sql.*;
public class AreaBean {
	private int areaid;
	private String area;
	private static Connection con =null;
	public int getAreaid() {
		return areaid;
	}
	public void setAreaid(int areaid) {
		this.areaid = areaid;
	}
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public static Connection getCon() throws ClassNotFoundException, SQLException {
		if(con==null){
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost/jobs?useUnicode=true&characterEncoding=UTF8","root","");
		}
		return con;

	}
	public static void setCon(Connection con) {
		AreaBean.con = con;
	}
	public ArrayList<String> getA(String s){
		 ArrayList<String> ab = new  ArrayList<String>();
		try{
		con = AreaBean.getCon();
		Statement st = con.createStatement();
		ResultSet rs = st.executeQuery("select * from area where id like '"+s+"'");
		while(rs.next()){
			ab.add(rs.getInt("id")+":"+rs.getString("name")+";");
		}
		}catch(Exception e){}
		return ab;
	}

}
